package io.github.xyzboom.cj

import kotlin.js.Json

fun getEnvVar(name: String): String? {
    val env = js("process.env").unsafeCast<Json>()
    return env[name] as? String
}

val devMode by lazy {
    getEnvVar("CJ_AST_VISUAL_DEV") == "true"
}

fun devPrintln() {
    if (devMode) {
        println()
    }
}

fun devPrintln(arg: Any?) {
    if (devMode) {
        println(arg)
    }
}